package com.demo.consumer.controller;

import com.demo.consumer.service.DemoUse;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DINGJIE
 * @version V1.0
 * @Description:
 * @date 2018/5/7 下午1:41
 */
@RestController
public class AddController {
    @Autowired
    DemoUse demoUse;

    @GetMapping(value = "add", produces = "application/json")
    public int add(@RequestParam int a, @RequestParam int b) {
        System.out.println("consumer start..");
        return demoUse.add(a, b);
    }

    @GetMapping(value = "user", produces = "application/json")
    public User getUser(@RequestParam int id) {
        System.out.println("get user start..");
        return demoUse.getUserById(id);
    }
}
